package com.stateofflow.invariantj;

import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;

public class NamedThrowableMap implements Serializable {
	private static final long serialVersionUID = -5114692893939353968L;
	
	private Map map;
    
    public NamedThrowableMap() {
        map = new TreeMap();
    }

    public void put(String name, Throwable t) {
        map.put(name, t);
    }

    public String[] getNames() {
        Collection keys = map.keySet();
        return (String[]) keys.toArray(new String[keys.size()]);
    }

    public Throwable get(String name) {
        return (Throwable) map.get(name);
    }

    public boolean isEmpty() {
        return map.isEmpty();
    }
}
